#pragma once

struct TSceneIntersection;
struct TCRTMesh;
struct RAY;

enum TraceType
{
	kStopOnFirstHit = 0,
	kNearestHit, 
	kAllHits, 
};

class ITraceResult
{
public: 
	virtual ~ITraceResult() {}

	virtual bool HitAny() const = 0;
	virtual size_t NumberOfHits() const = 0;
	virtual const TSceneIntersection* GetHit(size_t index) const = 0;

	virtual size_t NumberOfRayAABBTesting() const = 0;
	virtual size_t NumberOfRayTriangleTesting() const = 0;

	virtual void Reset() = 0;

	virtual void AddHit(const TSceneIntersection& hit, TraceType traceType) = 0;
	virtual void AddRayTriangleTesting() = 0;
	virtual void AddRayAABBTesting() = 0;

	virtual bool CanStopTrace() const = 0;
};

class ISpace
{
public: 
	virtual ~ISpace() {}
	
	// return number of meshes in the space
	virtual size_t ClearAllMeshes() = 0;
	virtual size_t AddMesh(const TCRTMesh* pMesh) = 0;
	virtual size_t GetNumberOfMeshes() const = 0;
	virtual const TCRTMesh* GetMesh(size_t index) const = 0;

	virtual bool BuildPartition() = 0;
	virtual ITraceResult* TraceRay(RAY* pRay, TraceType traceType) = 0;
};